package cn.tellfish.studydemo.demo;

import java.util.Map;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;

public class VectorTest {


    public static void main(String[] args) {


        Vector<String> vector = new Vector<>();



        vector.add("sdfasdf");
        vector.add("sdfasdf");
        vector.add("sdfasdf");
        vector.add("asdfsa");




//        for (String ses : vector) {
//
//
//            System.out.println(ses);
//
//        }
//        System.out.println(vector.size());


        ConcurrentHashMap<String,Object> map = new ConcurrentHashMap<>();

        map.put("stari","sdf");
        map.put("stefei","sdf");

        Set<Map.Entry<String, Object>> set = map.entrySet();
        for (Map.Entry<String, Object> entry : set) {
            System.out.println(entry.getKey() + "---->" +entry.getValue());
        }

//        map.put(null,null);

        CountDownLatch latch = new CountDownLatch(3);
        for (int i = 0; i < 3; i++) {
            new Thread(()->{
                try {
                    Thread.sleep(4000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                latch.countDown();
                try {
                    latch.await();


                    System.out.println("asdfasdf");
//                    map.put(null,null);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }


            }).start();
        }

    }


}
